Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 6 равно сумме своих собственных делителей 1 + 2 + 3.
Примеры совершенных чисел:
6, 28, 496, 8128
Решение:
def get_divisors(num): divisors = [] for i in range(1, num): if num % i == 0: divisors.append(i) return divisors
def perfect_num(num): divisors = get_divisors(num) return num == sum(divisors)
Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 6 равно сумме своих собственных делителей 1 + 2 + 3.
Примеры совершенных чисел:
6, 28, 496, 8128
Решение:
def get_divisors(num): divisors = [] for i in range(1, num): if num % i == 0: divisors.append(i) return divisors
def perfect_num(num): divisors = get_divisors(num) return num == sum(divisors)
A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.
A Telegram spokesman declined to comment on the bond issue or the amount of the debt the company has due. The spokesman said Telegram’s equipment and bandwidth costs are growing because it has consistently posted more than 40% year-to-year growth in users.
Python Turbo Уютное сообщество Python разработчиков from ru